package com.ncr.travel.tas.configuration;

import org.joda.time.Period;
import org.joda.time.format.PeriodFormat;
import org.joda.time.format.PeriodFormatter;

/**
 * @author Rob Cooke
 *
 */
public class ConfigurationUtils {
	
	public ConfigurationUtils(){
	}
	/**
	 * @param periodString
	 * @return
	 */
	public static Period parsePeriod(String periodString) {
		PeriodFormatter formatter = PeriodFormat.getDefault();
		return formatter.parsePeriod(periodString);
	}

	/**
	 * @param period
	 * @return
	 */
	public static String formatPeriod(Period period) {
		PeriodFormatter formatter = PeriodFormat.getDefault();
		return formatter.print(period);
	}
	
	public static String getString(Object input){
		if(input == null){
			return "";
		}
		else{
			return input.toString();
		}
		
	}
}
